package com.flt.dao;

import com.flt.dao.model.Menu;
import com.flt.dao.model.MenuExample;
import com.ibatis.sqlmap.client.SqlMapClient;

import java.util.List;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;

import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;
import org.springframework.stereotype.Repository;

@Repository
public class MenuDAOImpl extends SqlMapClientDaoSupport implements MenuDAO {
	
	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public MenuDAOImpl() {
		super();
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public void insert(Menu record) {
		getSqlMapClientTemplate().insert("t_menu.abatorgenerated_insert",
				record);
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int updateByPrimaryKey(Menu record) {
		int rows = getSqlMapClientTemplate().update(
				"t_menu.abatorgenerated_updateByPrimaryKey", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int updateByPrimaryKeySelective(Menu record) {
		int rows = getSqlMapClientTemplate().update(
				"t_menu.abatorgenerated_updateByPrimaryKeySelective", record);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public List selectByExample(MenuExample example) {
		List list = getSqlMapClientTemplate().queryForList(
				"t_menu.abatorgenerated_selectByExample", example);
		return list;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public Menu selectByPrimaryKey(Integer id) {
		Menu key = new Menu();
		key.setId(id);
		Menu record = (Menu) getSqlMapClientTemplate().queryForObject(
				"t_menu.abatorgenerated_selectByPrimaryKey", key);
		return record;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int deleteByExample(MenuExample example) {
		int rows = getSqlMapClientTemplate().delete(
				"t_menu.abatorgenerated_deleteByExample", example);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int deleteByPrimaryKey(Integer id) {
		Menu key = new Menu();
		key.setId(id);
		int rows = getSqlMapClientTemplate().delete(
				"t_menu.abatorgenerated_deleteByPrimaryKey", key);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int countByExample(MenuExample example) {
		Integer count = (Integer) getSqlMapClientTemplate().queryForObject(
				"t_menu.abatorgenerated_countByExample", example);
		return count.intValue();
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int updateByExampleSelective(Menu record, MenuExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"t_menu.abatorgenerated_updateByExampleSelective", parms);
		return rows;
	}

	/**
	 * This method was generated by Abator for iBATIS. This method corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	public int updateByExample(Menu record, MenuExample example) {
		UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
		int rows = getSqlMapClientTemplate().update(
				"t_menu.abatorgenerated_updateByExample", parms);
		return rows;
	}

	/**
	 * This class was generated by Abator for iBATIS. This class corresponds to the database table t_menu
	 * @abatorgenerated  Sat Nov 02 14:51:24 CST 2013
	 */
	private static class UpdateByExampleParms extends MenuExample {
		private Object record;

		public UpdateByExampleParms(Object record, MenuExample example) {
			super(example);
			this.record = record;
		}

		public Object getRecord() {
			return record;
		}
	}

	@Resource
	private SqlMapClient sqlMapClient;
	
	@PostConstruct
	public void initSqlMapClient(){
		super.setSqlMapClient(sqlMapClient);
	}
}